//
//  MapMenuItem.cpp
//  FruitCrush
//
//  Created by gaoyu on 15/7/7.
//
//

#include "MapMenuItem.h"

USING_NS_CC;

#define WIDTH   35
#define HEIGHT  30
#define TEXT_TAG 10

MapMenuItem::MapMenuItem()
{
}

MapMenuItem * MapMenuItem::create(const std::string& normalImage, const std::string& selectedImage, const std::string& disabledImage, const ccMenuCallback& callback)
{
    return (MapMenuItem *)MenuItemImage::create(normalImage, selectedImage, disabledImage, callback);
}

void MapMenuItem::SetNum(int num)
{
	if(getChildByTag(TEXT_TAG)){
		removeChildByTag(TEXT_TAG);
	}
    LabelTTF *numLabel = LabelTTF::create(Value(num).asString(), "arial", 15);
    numLabel->setAnchorPoint(Point(0, 0));
    numLabel->setPosition((WIDTH-numLabel->getContentSize().width)/2,
                          (HEIGHT - numLabel->getContentSize().height)/2);
    numLabel->setColor(Color3B::WHITE);
    addChild(numLabel,1,TEXT_TAG);
}

Size  MapMenuItem::getSize()
{
    return Size(WIDTH,HEIGHT);
}